/*
 * Copyright 2024 NXP
 * SPDX-License-Identifier: MIT
 */

#include "events_init.h"
#include <stdio.h>
#include "lvgl.h"

void events_init(lv_ui *ui)
{
}

static void mian_btn_1_event_handler(lv_event_t *e)
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.mian1))
			setup_scr_mian1(&guider_ui);
		lv_scr_load_anim(guider_ui.mian1, LV_SCR_LOAD_ANIM_OVER_LEFT, 0, 0, true);
	}
		break;
	default:
		break;
	}
}

void events_init_mian(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->mian_btn_1, mian_btn_1_event_handler, LV_EVENT_ALL, NULL);
}

static void mian1_btn_2_event_handler(lv_event_t *e)
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.mian2))
			setup_scr_mian2(&guider_ui);
		lv_scr_load_anim(guider_ui.mian2, LV_SCR_LOAD_ANIM_OVER_LEFT, 0, 0, true);
	}
		break;
	default:
		break;
	}
}

void events_init_mian1(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->mian1_btn_2, mian1_btn_2_event_handler, LV_EVENT_ALL, NULL);
}

static void mian2_btn_2_event_handler(lv_event_t *e)
{
	lv_event_code_t code = lv_event_get_code(e);
	switch (code)
	{
	case LV_EVENT_CLICKED:
	{
		if (!lv_obj_is_valid(guider_ui.mian))
			setup_scr_mian(&guider_ui);
		lv_scr_load_anim(guider_ui.mian, LV_SCR_LOAD_ANIM_OVER_LEFT, 0, 0, true);
	}
		break;
	default:
		break;
	}
}

void events_init_mian2(lv_ui *ui)
{
	lv_obj_add_event_cb(ui->mian2_btn_2, mian2_btn_2_event_handler, LV_EVENT_ALL, NULL);
}
